package vn.wallet.app.helper.validator;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

@FacesValidator("vn.wallet.app.passwordValidator")
public class PasswordValidator implements Validator {

	@Override
	public void validate(FacesContext context, UIComponent component,
			Object value) throws ValidatorException {

		if (!vn.wallet.app.helper.Validator.isValidPassword(value.toString())) {
			throw new ValidatorException(new FacesMessage(
					"E-mail validation failed.", "Password is not complex"));
		}

	}

}
